home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: presby.edu!jtbell
- From: jtbell@presby.edu (Jon Bell)
- Subject: Re: Inheritance vs Templates
- Message-ID: <Dnr699.1xM@presby.edu>
- Date: Mon, 4 Mar 1996 17:07:56 GMT
- References: <4hf345$bnp@gwen.pcug.co.uk>
- Organization: Presbyterian College, Clinton, South Carolina USA
-
- Andy <williams@template.com> wrote:
- >It seems that templates do nothing extra (except efficiency ?)
- >that could not be achieved using inheritance, and it seems that
- >inheritance is a more elegant approach?
-
- Have you tried to write a generic Stack class in such a way that you can
- have a Stack of integers, a Stack of doubles, and a Stack of, say,
- Employees, all in the same program?
-
- I think you'll find that this is difficult or impossible using
- inheritance alone, but is almost trivial using templates.
-
- --
- Jon Bell <jtbell@presby.edu> Presbyterian College
- Dept. of Physics and Computer Science Clinton, South Carolina USA
-